<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../base.jsp" %>
<style>
	.content-wrapper{margin-left: 0px}
</style>
<body class="hold-transition skin-blue sidebar-mini">

	<div class="wrapper">
		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>空闲节点<small>添加</small></h1>
				<ol class="breadcrumb">
					<li><a href="javascript:;"><i class="fa fa-dashboard"></i> 首页</a></li>
					<li class="active">添加空闲节点</li>
				</ol>
			</section>
			<!-- Main content -->
			<section class="content">
	            <!-- form start -->
				<form id="saveForm">
				<div class="row">
					<div class="col-md-12">
					<div class="box box-info">
			            <div class="box-header with-border">
			              <h3 class="box-title"> </h3>
			            </div>
			            <!-- /.box-header -->
			              <div class="box-body form-horizontal">
			               <div class="form-group">
			                 <label for="inputEmail3" class="col-sm-2 control-label">Ip地址</label>
			                 <div class="col-sm-3">
			                   <input type="text" class="form-control" name="ip" id="ip">
			                 </div>
			               </div>
			               <div class="form-group">
			                 <label for="inputEmail3" class="col-sm-2 control-label">操作系统</label>
			                 <div class="col-sm-3">
			                   <input type="text" class="form-control" id="system" name="system">
			                 </div>
			               </div>
			               
			               <div class="box-footer">
			                <a class="btn btn-info save">保存</a>
			                <a class="btn btn-default cancel" >取消</a>
			             </div>
			          </div>
			        </div>
				</form>
			</section>
		</div>
	</div>
	<script type="text/javascript">
	$(function () {
		$('.cancel').on('click',function(){
			location.href = path+'index/Index/index';
		});
		$('.save').on('click',function(){
			var ip = $('#ip').val();
			if(!ip){
				layer.msg("请填IP地址！");return;
			}
			var system = $('#system').val();
			if(!system){
				layer.msg("请填操作系统！");return;
			}
			$.post(path+'index/Index/addNodes',{ip:ip,system:system},function(data){
				if(data.status == '200'){
					layer.msg('添加成功', {
              		  closeBtn: 0
              		}, function(){
	            		location.href = path+'index/Index/index';
              		});
				}else{
					layer.msg('添加失败，请确认IP地址是否正确！');
				}
			});
		});
	});
	</script>
</body>